<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>职位详情 - 人才职业生涯规划平台</title>
    <link rel="stylesheet" href="../css/style.css">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.0/font/bootstrap-icons.css">
    <style>
        /* 基础样式 */
        body {
            background-color: #f5f7fa;
            color: #333;
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
            margin: 0;
            padding: 0;
            font-size: 14px;
        }
        
        .app-container {
            max-width: 375px; /* 标准小程序尺寸 */
            margin: 0 auto;
            background-color: #f5f7fa;
            min-height: 100vh;
            padding-bottom: 70px; /* 为底部按钮预留空间 */
        }
        
        /* 头部导航 */
        .page-header {
            display: flex;
            align-items: center;
            padding: 12px 16px;
            background-color: #fff;
            position: sticky;
            top: 0;
            z-index: 100;
        }
        
        .back-button {
            border: none;
            background: none;
            font-size: 18px;
            color: #333;
            padding: 0;
            margin-right: 12px;
            display: flex;
            align-items: center;
            cursor: pointer;
            -webkit-tap-highlight-color: transparent;
        }
        
        .page-title {
            font-size: 16px;
            font-weight: 600;
            flex: 1;
            text-align: center;
            margin: 0;
        }
        
        .action-button {
            border: none;
            background: none;
            font-size: 18px;
            color: #333;
            padding: 0;
            margin-left: 12px;
            display: flex;
            align-items: center;
            cursor: pointer;
            -webkit-tap-highlight-color: transparent;
        }
        
        /* 内容卡片 */
        .card {
            background-color: #fff;
            margin-bottom: 10px;
            padding: 16px;
        }
        
        /* 职位基本信息 */
        .job-header {
            margin-bottom: 0;
            border-radius: 0;
        }
        
        .job-title {
            font-size: 18px;
            font-weight: 600;
            color: #333;
            margin: 0 0 8px 0;
        }
        
        .job-salary {
            font-size: 16px;
            color: #ff6b6b;
            font-weight: 500;
            margin: 0 0 16px 0;
        }
        
        /* 要求信息 */
        .job-req-row {
            display: flex;
            border-bottom: 1px solid #f0f0f0;
            padding-bottom: 10px;
        }
        
        .job-req-item {
            flex: 1;
            display: flex;
            flex-direction: column;
            padding: 0 10px;
            position: relative;
        }
        
        .job-req-item:not(:last-child):after {
            content: '';
            position: absolute;
            right: 0;
            top: 5px;
            bottom: 5px;
            width: 1px;
            background-color: #f0f0f0;
        }
        
        .job-req-label {
            font-size: 12px;
            color: #999;
            margin-bottom: 5px;
        }
        
        .job-req-value {
            font-size: 14px;
            color: #333;
        }
        
        /* 职位标签 */
        .job-tags {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            margin: 16px 0 0 0;
            padding-top: 10px;
        }
        
        .job-tag {
            display: inline-block;
            padding: 4px 8px;
            background-color: #f7f7f7;
            color: #666;
            border-radius: 2px;
            font-size: 12px;
        }
        
        /* 职位详情 */
        .section-title {
            font-size: 16px;
            font-weight: 600;
            margin: 0 0 12px 0;
            color: #333;
        }
        
        .job-description {
            line-height: 1.6;
            color: #666;
            word-break: break-all;
        }
        
        .job-description p {
            margin: 0 0 10px 0;
        }
        
        .requirement-list {
            padding-left: 16px;
            margin: 0;
        }
        
        .requirement-list li {
            margin-bottom: 8px;
            color: #666;
            line-height: 1.6;
        }
        
        /* 公司信息 */
        .company-card {
            display: flex;
            align-items: center;
            padding-bottom: 15px;
            border-bottom: 1px solid #f0f0f0;
            margin-bottom: 15px;
        }
        
        .company-logo {
            width: 50px;
            height: 50px;
            border-radius: 4px;
            object-fit: contain;
            border: 1px solid #eee;
            margin-right: 12px;
        }
        
        .company-info {
            flex: 1;
        }
        
        .company-name {
            font-size: 16px;
            font-weight: 600;
            color: #333;
            margin: 0 0 4px 0;
        }
        
        .company-meta {
            font-size: 13px;
            color: #666;
        }
        
        .company-description {
            color: #666;
            line-height: 1.6;
            margin: 0;
        }
        
        /* 底部应用按钮 */
        .apply-button-container {
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            background-color: #fff;
            padding: 12px 16px;
            padding-bottom: calc(12px + env(safe-area-inset-bottom, 0));
            box-shadow: 0 -1px 4px rgba(0,0,0,0.05);
            z-index: 100;
            max-width: 375px;
            margin: 0 auto;
        }
        
        .apply-button {
            display: block;
            width: 100%;
            height: 44px;
            line-height: 44px;
            text-align: center;
            background-color: #4863dc;
            color: white;
            font-size: 16px;
            font-weight: 500;
            border-radius: 4px;
            border: none;
            cursor: pointer;
            -webkit-tap-highlight-color: transparent;
        }
        
        .apply-button:active {
            opacity: 0.85;
        }
        
        /* 加载和提示样式 */
        .loading-overlay {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-color: rgba(255, 255, 255, 0.8);
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            z-index: 1000;
        }
        
        .loading-spinner {
            width: 36px;
            height: 36px;
            border: 3px solid rgba(72, 99, 220, 0.2);
            border-radius: 50%;
            border-top-color: #4863dc;
            animation: spin 0.8s linear infinite;
            margin-bottom: 10px;
        }
        
        @keyframes spin {
            to { transform: rotate(360deg); }
        }
        
        .loading-text {
            font-size: 14px;
            color: #666;
        }
        
        .toast-message {
            position: fixed;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            background-color: rgba(0, 0, 0, 0.7);
            color: white;
            padding: 10px 16px;
            border-radius: 4px;
            font-size: 14px;
            z-index: 1001;
            animation: fadeInOut 2.5s ease forwards;
        }
        
        @keyframes fadeInOut {
            0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
            50% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
            100% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
        }
    </style>
</head>
<body>
    <div class="app-container">
        <!-- 头部导航 -->
        <header class="page-header">
            <button class="back-button" onclick="history.back()">
                <i class="bi bi-chevron-left"></i>
            </button>
            <h1 class="page-title">职位详情</h1>
            <button class="action-button" id="share-button">
                <i class="bi bi-share"></i>
            </button>
            <button class="action-button" id="favorite-button">
                <i class="bi bi-star"></i>
            </button>
        </header>
        
        <!-- 职位基本信息 -->
        <section class="card job-header">
            <h2 class="job-title">前端开发工程师</h2>
            <p class="job-salary">20k-30k · 14薪</p>
            
            <div class="job-req-row">
                <div class="job-req-item">
                    <div class="job-req-label">学历要求</div>
                    <div class="job-req-value">本科及以上</div>
                </div>
                <div class="job-req-item">
                    <div class="job-req-label">工作经验</div>
                    <div class="job-req-value">3-5年</div>
                </div>
                <div class="job-req-item">
                    <div class="job-req-label">工作地点</div>
                    <div class="job-req-value">北京</div>
                </div>
            </div>
            
            <div class="job-tags">
                <span class="job-tag">React</span>
                <span class="job-tag">Vue</span>
                <span class="job-tag">JavaScript</span>
                <span class="job-tag">TypeScript</span>
                <span class="job-tag">微前端</span>
            </div>
        </section>
        
        <!-- 公司信息 -->
        <section class="card">
            <div class="company-card">
                <img src="../img/company1.jpg" alt="公司Logo" class="company-logo">
                <div class="company-info">
                    <h3 class="company-name">字节跳动</h3>
                    <p class="company-meta">互联网 · 1000人以上 · 北京</p>
                </div>
            </div>
            <p class="company-description">字节跳动是全球估值最高的创业公司之一，拥有抖音、今日头条、西瓜视频等应用，在全球多个国家和地区开展业务，致力于为用户创造更有价值的信息和服务。</p>
        </section>
        
        <!-- 职位描述 -->
        <section class="card">
            <h3 class="section-title">职位描述</h3>
            <div class="job-description">
                <p>负责字节跳动旗下产品的前端开发，主要工作包括：</p>
                <ol class="requirement-list">
                    <li>负责公司核心项目的前端开发工作，与团队协作完成项目任务</li>
                    <li>参与需求评审，并根据需求进行技术方案设计和实现</li>
                    <li>持续优化前端架构，提升用户体验和页面性能</li>
                    <li>研究前沿技术，推动技术创新与应用</li>
                    <li>参与内部技术分享，提升团队整体技术水平</li>
                </ol>
            </div>
        </section>
        
        <!-- 任职要求 -->
        <section class="card">
            <h3 class="section-title">任职要求</h3>
            <div class="job-description">
                <ol class="requirement-list">
                    <li>本科及以上学历，3-5年前端开发经验</li>
                    <li>精通React、Vue等主流前端框架，熟悉TypeScript</li>
                    <li>熟悉前端工程化，有Webpack、Vite等构建工具使用经验</li>
                    <li>熟悉跨端开发技术，有小程序或React Native开发经验优先</li>
                    <li>良好的团队合作精神和沟通能力，能独立解决复杂问题</li>
                    <li>有大型互联网公司工作经验或重点高校背景优先</li>
                </ol>
            </div>
        </section>
        
        <!-- 底部应用按钮 -->
        <div class="apply-button-container">
            <button class="apply-button" id="apply-button">立即申请</button>
        </div>
    </div>

    <script>
        document.addEventListener('DOMContentLoaded', function() {
            // 获取URL参数
            const urlParams = new URLSearchParams(window.location.search);
            const jobId = urlParams.get('id') || '1001';
            const source = urlParams.get('from');
            
            // 添加收藏按钮事件
            const favoriteButton = document.getElementById('favorite-button');
            let isFavorite = false;
            
            favoriteButton.addEventListener('click', function() {
                isFavorite = !isFavorite;
                if (isFavorite) {
                    this.innerHTML = '<i class="bi bi-star-fill" style="color: #ffc107;"></i>';
                    showToast('已加入收藏');
                } else {
                    this.innerHTML = '<i class="bi bi-star"></i>';
                    showToast('已取消收藏');
                }
            });
            
            // 分享按钮事件
            document.getElementById('share-button').addEventListener('click', function() {
                // 模拟分享弹窗
                showToast('分享功能暂未开放');
            });
            
            // 申请按钮事件
            document.getElementById('apply-button').addEventListener('click', function() {
                showLoading();
                
                // 根据来源判断是否已申请
                if (source === 'application') {
                    setTimeout(() => {
                        hideLoading();
                        showToast('您已经申请过该职位');
                        
                        // 返回上一页
                        setTimeout(() => {
                            history.back();
                        }, 1500);
                    }, 1000);
                } else {
                    // 模拟申请过程
                    setTimeout(() => {
                        hideLoading();
                        
                        // 跳转到简历选择页面
                        window.location.href = `resume-select.html?job_id=${jobId}`;
                    }, 1000);
                }
            });
        });
        
        // 显示加载状态
        function showLoading() {
            if (!document.querySelector('.loading-overlay')) {
                const loadingEl = document.createElement('div');
                loadingEl.className = 'loading-overlay';
                loadingEl.innerHTML = '<div class="loading-spinner"></div><div class="loading-text">加载中...</div>';
                document.body.appendChild(loadingEl);
            }
        }
        
        // 隐藏加载状态
        function hideLoading() {
            const loadingEl = document.querySelector('.loading-overlay');
            if (loadingEl) {
                document.body.removeChild(loadingEl);
            }
        }
        
        // 显示提示消息
        function showToast(message) {
            const toast = document.createElement('div');
            toast.className = 'toast-message';
            toast.textContent = message;
            document.body.appendChild(toast);
            
            // 自动消失
            setTimeout(() => {
                document.body.removeChild(toast);
            }, 2500);
        }
    </script>
</body>
</html> 